<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>关键字管理</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/backStyle.css">
<link rel="stylesheet" href="css/style.css"></link>
<link rel="stylesheet" type="text/css" href="css/myButton.css">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap-modal.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>

<style>
html,body {
	height: 100%;
	width: 100%;
	border: 0;
	background: #fff;
	overflow-y: auto;
}

.button {
	margin-top: 1.5em;
	margin-left: 12em;
}

label {
    width: 8em;
}
</style>
</head>
<body>
	<ul class="breadcrumb">
		<li><a href="sys/welcome.jsp">首页</a></li>
		<li class="active"><a href="keywordManageShow.action">关键字管理</a></li>
		<li class="active">关键字查看</li>
	</ul>
	<div class="panel panel-default">
		<div class="panel-body">
			<div class="form">
				<form action="keywordManageEdit.action" id="keywordInfor">
					<input name="configuration.id" type="hidden" value="<s:property value="configuration.id"/>">
					<p>
						<label>名称：</label>
						<span><input type="text" name="configuration.name" value="<s:property value="configuration.name"/>"  id="configurationName"/></span>
						<span class="redstar">*</span>
					</p>
					<p>
						<label>英文名称：</label>
						<span><input type="text" name="configuration.nameEn" value="<s:property value="configuration.nameEn"/>" id="configurationNameEn"/></span>
						<span class="redstar">*</span>
					</p>
					<p>
						<label>关键字段1：</label>
						<span><input type="text" name="configuration.value1" value="<s:property value="configuration.value1"/>" id="configurationValue1"/></span>
						<span class="redstar">*</span>
					</p>
					<p>
						<label>关键字段2：</label>
						<span><input type="text" name="configuration.value2" value="<s:property value="configuration.value2"/>" id="configurationValue2"/></span>
					</p>
					<p>
						<label>关键字段3：</label>
						<span><input type="text" name="configuration.value3" value="<s:property value="configuration.value3"/>" id="configurationValue3"/></span>
					</p>
					<p>
						<label>关键字段4：</label>
						<span><input type="text" name="configuration.value4" value="<s:property value="configuration.value4"/>" id="configurationValue4"/></span>
					</p>
					<input id="configurationInforSubmit" type="button" value="保存关键字信息" onclick="configurationCheck()" class="button black">
				</form>
				</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	function configurationCheck() {
		var configurationName = $("#configurationName").val();
		var configurationNameEn = $("#configurationNameEn").val();
		var configurationValue1 = $("#configurationValue1").val();
		if (configurationName.length<1||configurationName.length>64) {
			alert("请输入不超过64位的名称");
			document.getElementById("configurationName").focus();
			$("#configurationName").val("${configuration.name}");
			return false;
		}
		if (configurationNameEn.length<1||configurationNameEn.length>64) {
			alert("请输入不超过64位的英文名称");
			document.getElementById("configurationNameEn").focus();
			$("#configurationNameEn").val("${configuration.nameEn}");
			return false;
		}
		if (configurationValue1.length<1||configurationValue1.length>64) {
			alert("请输入不超过64位的关键字段1");
			document.getElementById("configurationValue1").focus();
			$("#configurationValue1").val("${configuration.value1}");
			return false;
		}
		if (confirm('您是否要保存关键字？')) {
			$.ajax({
				url : "keywordManageEdit.action",
				type : "post",
				dataType : "json",
				data : $("#keywordInfor").serialize(),
				success : function(data) {
					var flag = JSON.parse(data).flag;
					if (flag == "success") {
						alert("保存关键字成功！");
						window.location.href = "keywordManageShow.action";
					} else {
						alert("保存关键字失败！");
					}
				}
			});
		} else {
			return false;
		}
	}
</script>
</html>
